﻿@model Snow.AuthorityManagement.Core.Dto.Role.GetRoleForEditOutput
@*<link href="~/lib/zTree/css/demo.css" rel="stylesheet" />*@
@*<link href="~/lib/zTree/css/metroStyle/metroStyle.css" rel="stylesheet" />*@
<form asp-controller="Role" asp-action="CreateOrEdit" id="modelForm" method="post" enctype="multipart/form-data"
      data-ajax="true" data-ajax-success="saveSuccess" data-ajax-failure="saveFailure">
    @Html.AntiForgeryToken()
    <input type="hidden" id="Permissions" name="Permission" />
    <div>
        <!-- Nav tabs -->
        <ul class="nav nav-tabs" role="tablist">
            <li role="presentation" class="active"><a href="#base" aria-controls="base" role="tab" data-toggle="tab">基本信息</a></li>
            <li role="presentation"><a href="#permissions" aria-controls="permissions" role="tab" data-toggle="tab">权限</a></li>
        </ul>

        <!-- Tab panes -->
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="base">
                <div class="modal-body form-horizontal" id="modify">
                    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
                    <input type="hidden" asp-for="Role.ID" />
                    <div class="form-group">
                        <label asp-for="Role.Name" class="control-label col-md-2"></label>
                        <div class="col-md-10">
                            <input asp-for="Role.Name" class="form-control" placeholder="@Html.DisplayNameFor(model => model.Role.Name)" />
                            <span asp-validation-for="Role.Name" class="text-danger"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label asp-for="Role.Sort" class="control-label col-md-2"></label>
                        <div class="col-md-10">
                            <input asp-for="Role.Sort" class="form-control" placeholder="@Html.DisplayNameFor(model => model.Role.Sort)" />
                            <span asp-validation-for="Role.Sort" class="text-danger"></span>
                        </div>
                    </div>
                </div>
            </div>
            <div role="tabpanel" class="tab-pane" id="permissions"><ul id="authTree" class="ztree"></ul></div>
        </div>
    </div>
</form>
<script src="~/js/role/createOrEdit.js"></script>
<script type="text/javascript">
    $.validator.unobtrusive.parse('form');
    var zNodes = @Html.Raw(Model.Permission);
</script>